package com.example.spring_project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.spring_project.entity.Book;
import org.apache.ibatis.annotations.*;

@Mapper
public interface BookMapper extends BaseMapper<Book> {
    @Select("select * from book where book_id=#{id}")
    Book getById(int id);
    @Delete("delete from book where book_id=#{id}")
    int deleteBookById(int id);
    @Update("update book SET in_stock = #{inStock} where book_id = #{bookId}")
    int updateBookStockById(@Param("bookId") int bookId,@Param("inStock") int inStock);
    @Select("select in_stock from book where book_id=#{id}")
    int queryStockById(int id);
}
